//
//  LCAudioCoCell.m
//  TheLCNews
//
//  Created by apple on 15/12/2.
//  Copyright © 2015年 LC. All rights reserved.
//

#import "LCAudioCoCell.h"
#import "LCAudelModel.h"
@implementation LCAudioCoCell


- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.picImageView = [[UIImageView alloc] init];
        [self.contentView addSubview:self.picImageView];
       
        self.titleNameLabel = [[UILabel alloc] init];
        [self.contentView addSubview:self.titleNameLabel];
        
        self.channelNameLabel = [[UILabel alloc] init];
        [self.contentView addSubview:self.channelNameLabel];
        
    }
    
    return self;
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    
    self.picImageView.frame = CGRectMake(0, 0, CWIDTH, CHEIGHT / 4 * 3);
//    self.picImageView.backgroundColor = [UIColor whiteColor];
    
    self.titleNameLabel.frame = CGRectMake(0, self.picImageView.frame.size.height, CWIDTH, CHEIGHT / 8);
//        self.titleNameLabel.backgroundColor = [UIColor orangeColor];
    
    self.channelNameLabel.frame = CGRectMake(0, self.picImageView.frame.size.height + self.titleNameLabel.frame.size.height, CWIDTH, CHEIGHT / 11);
//        self.channelNameLabel.backgroundColor = [UIColor redColor];
}

- (void)setModel:(LCAudelModel *)model{
    if (_model != model) {
        _model = model;
    }
    
    [self.picImageView sd_setImageWithURL:[NSURL URLWithString:model.pic] placeholderImage:[UIImage imageNamed:@"ppp"]];
    
    self.titleNameLabel.text = model.name;
    self.titleNameLabel.font = [UIFont systemFontOfSize:14.5 ];
    
    self.channelNameLabel.text = [NSString stringWithFormat:@"%@ 频道", [model.channel objectForKey:@"name"]];
    self.channelNameLabel.textColor = [UIColor greenColor];
    self.channelNameLabel.font = [UIFont systemFontOfSize:12.5 ];
}









/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
